<template>
	<view class="recharge_body">
		<view class="content">
			<view class="recharge_title ">
				<view></view>
				<view>充值方式</view>
			</view>
			<view class="recharge_content" v-for='(item, index) in direct_data' :key="index">
				<view class="recharge_item">
					<view>充值金额</view>
					<view>￥{{item.money}}</view>
				</view>
				<view class="recharge_item" v-if="item.give_money">
					<view>赠送金额</view>
					<view>￥{{item.give_money}}</view>
				</view>
				<view class="recharge_item">
					<view>充值时间</view>
					<view>{{item.pay_time}}</view>
				</view>
				<view class="recharge_item">
					<view>实付金额</view>
					<view>￥{{item.money}}</view>
				</view>
				<view class="recharge_item">
					<view>到账方式</view>
					<view>{{install_name}}</view>
				</view>
			</view>
		</view>
		<view class="content" v-if="install_data.length">
			<view class="recharge_title ">
				<view>到账时间</view>
				<view>到账金额</view>
			</view>
			<view class="recharge_content">
				<view class="recharge_item" v-for="(item,index) in install_data" :key="index">
					<view>{{item.aging_date}}</view>
					<view>￥{{item.aging_money}}
						<text class="upgrade_name" v-if="item.upgrade_name == '已到账'">{{item.upgrade_name}}</text>
						<text class="error_upgrade_name" v-if="item.upgrade_name == '未到账'">{{item.upgrade_name}}</text>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				id: 0,
				vid: 0,
				direct_data:[],
				install_name:'',
				install_data: [],
			}
		},
		onLoad: function (options) {
		  if(options && options.id && options.vid){
			  this.setData({
				  id: options.id,
				  vid: options.vid
			  })
			  this.getRechargeDetails()
		  }
		},
		methods: {
			getRechargeDetails() {
			  uni.showLoading({
			    title: '加载中...',
			    mask: true
			  });
			  var that = this;
			  getApp().globalData.sendRequest({
			    url: '/Vip/getInstallData',
			    type: "post",
				data: {
				  id: this.id,
				  vid: this.vid
				},
			    success: function (res) {
			      uni.hideLoading();
			
			      if (res.status == 1) {
					that.setData({
						install_name: res.install_name,
						direct_data: res.direct_data,
						install_data: res.install_data
					})  
			      } else {
			        
			      }
			    }
			  });
			}
		}
	}
</script>

<style>
	page{
		background: #f6f6f6;
		box-sizing: border-box;
	}
	.recharge_body{
		background: #F6F6F6;
	}
	.content{
		margin: 20rpx;
		padding: 20rpx 26rpx;
		background: #FFFFFF;
		
	}
	.recharge_title{
		display: flex;
		justify-content: space-between;
		border-bottom: 1rpx solid #f7f7f7;
		padding: 20rpx 0;
	}
	.recharge_item{
		display: flex;
		justify-content: space-between;
		margin-top: 10rpx;
	}
	.upgrade_name{
		color: #999999;
		margin-left: 20rpx;
	}
	.error_upgrade_name{
		color: #eb4d5e;
		margin-left: 20rpx;
	}
</style>
